<?php 
class CBaseComment extends CBaseEosSingular {

	protected $m_intId;
	protected $m_intModuleId;
	protected $m_intBlogId;
	protected $m_intItemId;
	protected $m_strComment;
	protected $m_boolIsStatus;
	protected $m_strCreatedBy;
	protected $m_strCreatedOn;
	
	public function __construct() {		
		parent::__construct();
		return true;
	}
	
	public function assign( $mixArr ) {		
		
	}
	
	/**************************************
	************* SET FUNCTIONS ***********
	**************************************/
	
	public function setId( $intId ) {
		$this->m_intId = $intId;
	}
	
	public function setModuleId( $intModuleId ) {
		$this->m_intModuleId = $intModuleId;
	}
	
	public function setBlogId( $intBlogId ) {
		$this->m_intBlogId = $intBlogId;
	}
	
	public function setItemId( $intItemId ) {
		$this->m_intItemId = $intItemId;
	}
	
	public function setComment( $strComment ) {
		$this->m_strComment = $strComment;
	}
	
	public function setIsStatus( $boolIsStatus ) {
		$this->m_boolIsStatus = $boolIsStatus;
	}

	public function setCreatedBy( $strCreatedBy ) {
		$this->m_strCreatedBy = $strCreatedBy;
	}
	
	public function setCreatedOn( $strCreatedOn ) {
		$this->m_strCreatedOn = $strCreatedOn;
	}
	
	
	/**************************************
	************* GET FUNCTIONS ***********
	**************************************/
	
	public function getId( ) {
		return $this->m_intId;
	}
	
	public function getBlogId( ) {
		return $this->m_intBlogId;
	}
	
	public function getModuleId() {
		return $this->m_intModuleId;
	}
	
	public function getItemId() {
		return $this->m_intItemId;
	}
	
	public function getComment() {
		return $this->m_strComment;
	}
	
	public function getIsStatus() {
		return $this->m_boolIsStatus;
	}
		
	public function getCreatedBy() {
		return $this->m_strCreatedBy;
	}
	
	public function getCreatedOn() {
		return $this->m_strCreatedOn;
	}
	

	/**************************************
	************* DATABASE FUNCTIONS ***********
	**************************************/
	
	public function insert( $objDatabase ) {
		$strSql  = ' INSERT INTO `comments` (`module_id`, `item_id`, `blog_id`,  `comment`, `is_status`, `created_by`, `created_on`)';
		$strSql .= ' VALUES ( \'' . $this->getModuleId() . '\',';
		$strSql .= ' \'' . $this->getItemId() . '\',';
		$strSql .= ' \'' . $this->getBlogId() . '\',';
		$strSql .= ' \'' . $this->getComment() . '\',';
		$strSql .= ' \'' . $this->getIsStatus() . '\',';
		$strSql .= ' \'' . $this->getCreatedBy() . '\',';
		$strSql .= ' \'' . $this->getCreatedOn() . '\');';

		parent::insertRecord( $strSql, $objDatabase );
	}
	
	public function update( $objDatabase ) {
		$strSql  = ' UPDATE `comments` SET ';
		$strSql .= ' `module_id` = \'' . $this->getModuleId() . '\',';
		$strSql .= ' `item_id` = \'' . $this->getItemId() . '\',';
		$strSql .= ' `blog_id` = \'' . $this->getBlogId() . '\',';
		$strSql .= ' `comment` =  \'' . $this->getComment() . '\',';
		$strSql .= ' `is_status` = \'' . $this->getIsStatus() . '\',';
		$strSql .= ' `created_by` = \'' . $this->getCreatedBy() . '\',';
		$strSql .= ' `created_on` = \'' . $this->getCreatedOn() . '\'';
		$strSql .= ' WHERE `id` = \'' . $this->getId() . '\';';
	
		return parent::updateRecord( $strSql, $objDatabase );
	}
	
	public function delete( $objDatabase ) {
	
		$strSql = ' DELETE FROM `comments` WHERE `id` = ' . $this->getId();
		return parent::deleteRecord( $strSql, $objDatabase );
	}
	
}

?>